Updated “07 May 2016”

Bipartite Networks

  • Community ecology's gateway to ecological networks

Bipartite Networks

Examples:

  • Plant Pollinator
  • Plant Herbivore
  • Plant Parasite

Advantage and Limitation

  • Simple, provides a theoretical framework
  • Simple, a sub-set of the entire network

Individuals

  • Bat Roost

Genetic Networks

  • Know the genotype, know the individual (for the most part, Bailey et al. 2012)

Base Quantities

  • L: number of realized links in a network
  • I: number of lower trophic level species (e.g. plants, prey)
  • J: number of higher trophic level species (e.g. pollinators, parasitoids)
  • m: total number of interactions for all species
  • \(a_{ij}\): number of interactions between species i from the lower and species j from the higher trophic level, also referred as “link weight”
  • \(A_i\) (\(\sum_{j=1}^J a_{ij}\)): total number of interactions of species i from the ower trophic level
  • \(A_j\) (\(\sum_{i=1}^I a_{ij}\)): total number of interactions of species j from the higher trophic level

Indices (Unweighted)

  • Links per Species
  • Connectance
  • Cluster Coefficient
  • Web Asymmetry
  • Number of Compartments
  • Extinction Slopes
  • Degree Distribution
  • Mean Number of Shared Hosts
  • Togetherness
  • C-Score
  • V-Ratio
  • Nestedness

Weighted Indices

  • Nestedness (WINE)
  • Modularity
  • Generality
  • Vulnerability
  • Weighted Linkage Density
  • Interaction Evenness
  • Interaction Strength Asymmetry
  • Niche Overlap

Weighted Indices

  • Nestedness
  • Modularity
  • Generality
  • Vulnerability
  • Weighted Linkage Density
  • Interaction Evenness
  • Interaction Strength Asymmetry
  • Niche Overlap

Nestedness

Nestedness: Packing Communities

Nestedness: Packing Communities

Measuring Nestedness: Many Metrics

1. Ordering

2. Isocline

3. Deviations

Exercise: Play with matrix ordering

Exercise: Play with matrix ordering

M <- c(rep(1,10),
        c(rep(1,4),rep(0,6)),
        c(rep(1,3),rep(0,7)),
        c(rep(1,2),rep(0,8)),
        rep(c(rep(1,1),rep(0,9)),6)
         )
M <- matrix(M,nrow=10)
rownames(M) <- paste('P',1:10,sep='')
colnames(M) <- paste('A',1:10,sep='')

Exercise: Play with matrix ordering

M
##     A1 A2 A3 A4 A5 A6 A7 A8 A9 A10
## P1   1  1  1  1  1  1  1  1  1   1
## P2   1  1  1  1  0  0  0  0  0   0
## P3   1  1  1  0  0  0  0  0  0   0
## P4   1  1  0  0  0  0  0  0  0   0
## P5   1  0  0  0  0  0  0  0  0   0
## P6   1  0  0  0  0  0  0  0  0   0
## P7   1  0  0  0  0  0  0  0  0   0
## P8   1  0  0  0  0  0  0  0  0   0
## P9   1  0  0  0  0  0  0  0  0   0
## P10  1  0  0  0  0  0  0  0  0   0

Exercise: Play with matrix ordering

M[sample(1:10,10),sample(1:10,10)]
##     A8 A10 A4 A6 A5 A9 A7 A1 A3 A2
## P1   1   1  1  1  1  1  1  1  1  1
## P4   0   0  0  0  0  0  0  1  0  1
## P10  0   0  0  0  0  0  0  1  0  0
## P3   0   0  0  0  0  0  0  1  1  1
## P7   0   0  0  0  0  0  0  1  0  0
## P2   0   0  1  0  0  0  0  1  1  1
## P9   0   0  0  0  0  0  0  1  0  0
## P5   0   0  0  0  0  0  0  1  0  0
## P8   0   0  0  0  0  0  0  1  0  0
## P6   0   0  0  0  0  0  0  1  0  0

Exercise: Play with matrix ordering

M[sample(1:10,10),sample(1:10,10)]
##     A4 A6 A1 A2 A3 A8 A5 A10 A7 A9
## P3   0  0  1  1  1  0  0   0  0  0
## P1   1  1  1  1  1  1  1   1  1  1
## P8   0  0  1  0  0  0  0   0  0  0
## P2   1  0  1  1  1  0  0   0  0  0
## P7   0  0  1  0  0  0  0   0  0  0
## P9   0  0  1  0  0  0  0   0  0  0
## P10  0  0  1  0  0  0  0   0  0  0
## P6   0  0  1  0  0  0  0   0  0  0
## P4   0  0  1  1  0  0  0   0  0  0
## P5   0  0  1  0  0  0  0   0  0  0

Exercise: Play with matrix ordering

M[sample(1:10,10),sample(1:10,10)]
##     A1 A2 A7 A6 A8 A5 A9 A4 A3 A10
## P1   1  1  1  1  1  1  1  1  1   1
## P10  1  0  0  0  0  0  0  0  0   0
## P4   1  1  0  0  0  0  0  0  0   0
## P6   1  0  0  0  0  0  0  0  0   0
## P7   1  0  0  0  0  0  0  0  0   0
## P3   1  1  0  0  0  0  0  0  1   0
## P9   1  0  0  0  0  0  0  0  0   0
## P2   1  1  0  0  0  0  0  1  1   0
## P8   1  0  0  0  0  0  0  0  0   0
## P5   1  0  0  0  0  0  0  0  0   0

Testing for Nestedness

  • Calculate the nestedness for a given network
  • Choose an algorithm to shuffle
  • Shuffle the interactions
  • Calculate nestedness for the shuffled network
  • Repeat a lot, like thousands of times
  • Compare the observed to the "null" nestedness values

Testing for Nestedness

obs <- 45
null <- rnorm(1000,65,9)
hist(null,main='')
abline(v=obs)

Testing for Nestedness

z.score <- (obs - mean(null)) / sd(null)
p.value <- length(null[null <= obs])/length(null)

z.score
## [1] -2.229478
p.value
## [1] 0.011

Exercise: Nestedness Analysis

library(bipartite)
data(Safariland)
Safariland

Exercise: Nestedness Analysis

##                          Policana albopilosa Bombus dahlbomii
## Aristotelia chilensis                    673                0
## Alstroemeria aurea                         0              154
## Schinus patagonicus                        0                0
## Berberis darwinii                          0               67
## Rosa eglanteria                            0                0
## Cynanchum diemii                           0                0
## Ribes magellanicum                         0                0
## Mutisia decurrens                          0                0
## Calceolaria crenatiflora                   0                0
##                          Ruizantheda mutabilis Trichophthalma amoena
## Aristotelia chilensis                      110                     0
## Alstroemeria aurea                           0                     0
## Schinus patagonicus                          0                     0
## Berberis darwinii                            0                     0
## Rosa eglanteria                              6                     0
## Cynanchum diemii                             0                     0
## Ribes magellanicum                           0                     2
## Mutisia decurrens                            0                     0
## Calceolaria crenatiflora                     0                     0
##                          Syrphus octomaculatus Manuelia gayi
## Aristotelia chilensis                        0             0
## Alstroemeria aurea                           5             7
## Schinus patagonicus                          0             0
## Berberis darwinii                            5             0
## Rosa eglanteria                              4             0
## Cynanchum diemii                             0             0
## Ribes magellanicum                           0             0
## Mutisia decurrens                            0             0
## Calceolaria crenatiflora                     0             0
##                          Allograpta.Toxomerus Trichophthalma jaffueli
## Aristotelia chilensis                       0                       0
## Alstroemeria aurea                          1                       3
## Schinus patagonicus                         0                       0
## Berberis darwinii                           0                       0
## Rosa eglanteria                             2                       0
## Cynanchum diemii                            0                       0
## Ribes magellanicum                          3                       0
## Mutisia decurrens                           0                       0
## Calceolaria crenatiflora                    1                       0
##                          Phthiria Platycheirus1 Sapromyza.Minettia
## Aristotelia chilensis           0             4                  0
## Alstroemeria aurea              8             1                  1
## Schinus patagonicus             0             0                  0
## Berberis darwinii               0             0                  0
## Rosa eglanteria                 0             0                  0
## Cynanchum diemii                0             0                  0
## Ribes magellanicum              0             0                  0
## Mutisia decurrens               1             0                  0
## Calceolaria crenatiflora        0             0                  0
##                          Formicidae3 Nitidulidae Staphilinidae
## Aristotelia chilensis              0           0             0
## Alstroemeria aurea                 0           0             4
## Schinus patagonicus                0           0             0
## Berberis darwinii                  0           0             0
## Rosa eglanteria                    0           0             3
## Cynanchum diemii                   8           1             0
## Ribes magellanicum                 0           0             0
## Mutisia decurrens                  0           0             0
## Calceolaria crenatiflora           0           0             0
##                          Ichneumonidae4 Braconidae3 Chalepogenus caeruleus
## Aristotelia chilensis                 1           0                      0
## Alstroemeria aurea                    0           0                      0
## Schinus patagonicus                  15           0                      0
## Berberis darwinii                     0           0                      0
## Rosa eglanteria                       0           0                      0
## Cynanchum diemii                      0           2                      0
## Ribes magellanicum                    0           0                      0
## Mutisia decurrens                     0           0                      0
## Calceolaria crenatiflora              0           0                      3
##                          Vespula germanica Torymidae2 Phthiria1
## Aristotelia chilensis                    0          0         0
## Alstroemeria aurea                       4          0         1
## Schinus patagonicus                      0          0         0
## Berberis darwinii                        0          0         0
## Rosa eglanteria                          0          0         0
## Cynanchum diemii                         0          9         0
## Ribes magellanicum                       0          0         0
## Mutisia decurrens                        0          0         0
## Calceolaria crenatiflora                 0          0         0
##                          Svastrides melanura Sphecidae Thomisidae
## Aristotelia chilensis                      0         0          0
## Alstroemeria aurea                         6         1          1
## Schinus patagonicus                        0         0          0
## Berberis darwinii                          0         0          0
## Rosa eglanteria                            0         0          0
## Cynanchum diemii                           0         0          0
## Ribes magellanicum                         0         0          0
## Mutisia decurrens                          0         0          0
## Calceolaria crenatiflora                   0         0          0
##                          Corynura prothysteres Ichneumonidae2
## Aristotelia chilensis                        1              0
## Alstroemeria aurea                           3              4
## Schinus patagonicus                          0              0
## Berberis darwinii                            0              0
## Rosa eglanteria                              0              0
## Cynanchum diemii                             0              0
## Ribes magellanicum                           0              0
## Mutisia decurrens                            0              0
## Calceolaria crenatiflora                     0              0
##                          Ruizantheda proxima Braconidae2
## Aristotelia chilensis                      0           1
## Alstroemeria aurea                         4           0
## Schinus patagonicus                        0           0
## Berberis darwinii                          0           0
## Rosa eglanteria                            0           0
## Cynanchum diemii                           0           0
## Ribes magellanicum                         0           0
## Mutisia decurrens                          0           0
## Calceolaria crenatiflora                   0           0

Exercise: Nestedness Analysis

plotweb(Safariland)

Exercise: Nestedness Analysis

plotweb(Safariland,text.rot=90)

Exercise: Nestedness Analysis

nested(Safariland)
## binmatnest2.temperature 
##                 19.7102

Exercise: Nestedness Analysis

nested(Safariland,method='ALL')
##  binmatnest2.temperature               binmatnest discrepancy2.discrepancy 
##               20.9779318                5.7626076               15.0000000 
##              discrepancy                  C.score                  checker 
##               21.0000000                0.5616097                1.0227920 
##                    NODF2                     NODF            weighted NODF 
##               24.5478036               18.0878553               11.6063738 
##                     wine 
##                0.4586208

Exercise: Nestedness Analysis

safari.nest <- nestedness(Safariland)
names(safari.nest)
##  [1] "mat"             "n.rows"          "n.cols"         
##  [4] "temperature"     "n.nullmodels"    "population.size"
##  [7] "n.individuals"   "binmatnestout"   "n.generations"  
## [10] "nullmodels"      "p.null1"         "mean.temp.null1"
## [13] "var.temp.null1"  "p.null2"         "mean.temp.null2"
## [16] "var.temp.null2"  "p.null3"         "mean.temp.null3"
## [19] "var.temp.null3"  "pack.order.col"  "pack.order.row" 
## [22] "packed.matrix"

Exercise: Nestedness Analysis

unlist(safari.nest[c('temperature')])
## temperature 
##    5.762608
unlist(safari.nest[c('p.null1','p.null2','p.null3')])
## p.null1 p.null2 p.null3 
##       0       0       0
unlist(safari.nest[c('mean.temp.null1','mean.temp.null2','mean.temp.null3')])
## mean.temp.null1 mean.temp.null2 mean.temp.null3 
##        28.14982        27.33150        18.72031
unlist(safari.nest[c('var.temp.null1','var.temp.null2','var.temp.null3')])
## var.temp.null1 var.temp.null2 var.temp.null3 
##       27.66088       33.82524       36.37121

Modularity

Modularity: Eggs in Multiple Baskets

Nestedness Revisited

Nestedness Revisited

Modularity: Eggs in Multiple Baskets

Modularity: Eggs in Multiple Baskets

Modularity

safari.mods <- computeModules(Safariland)

Modularity

plotModuleWeb(safari.mods)

Testing Modularity

null.nets <- lapply(1:5,commsimulator,x=Safariland,method='r1')
null.mods <- lapply(null.nets,computeModules)
null.stats <- lapply(null.mods,function(x) slot(x,'likelihood'))
null.stats <- unlist(null.stats)

Testing Modularity

obs.mods <- slot(safari.mods,'likelihood')
null.mu <- mean(null.stats)
null.sd <- sd(null.stats)
null.z <- (obs.mods - null.mu) / null.sd
null.p <- length(null.stats[null.stats <= obs.mods])/length(null.stats)
null.z
## [1] -1.716951
null.p
## [1] 0

Nested and Modules

Further reading on bipartite network analysis